<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>ajax-get请求方法</title>
		<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<form action="index.html" method="get" enctype="application/x-www-form-urlencoded">
			<input type="text" name="username" id="username" value="" placeholder="请输入用户名" /><br /><br />
			<input type="password" name="password" id="password" value="" placeholder="请输入密码" /><br /><br />
			<button type="submit">登录</button>
		</form>
		<script type="text/javascript">
			//AJAX: Asynchronous JavaScript and XML
			//异步的js与XML:
			//在不重载页面的条件下更新页面数据
			$('form').submit(function(ev) {
				//阻止表单的默认提交事件
				ev.preventDefault();
				//获取表单数据,自动将其转换成字符串序列化对
				var data = $(this).serialize();
				$.get({
					url: 'index.html',
					data,
					success: function(resData) {

					}
				})
			})
		</script>
	</body>

</html>